<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="Step 1: Enabling MySQL/MariaDB/GreatSQL Database Permissions">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="en-us_topic_0000002164603390.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="">
<meta name="DC.Publisher" content="20250306">
<meta name="documenttype" content="usermanual">
<meta name="prodname" content="csbs">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="EN-US_TOPIC_0000002164603378">
<meta name="DC.Language" content="en-us">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>Step 1: Enabling MySQL/MariaDB/GreatSQL Database Permissions</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="EN-US_TOPIC_0000002164603378"></a><a name="EN-US_TOPIC_0000002164603378"></a>

<h1 class="topictitle1">Step 1: Enabling MySQL/MariaDB/GreatSQL Database Permissions</h1>
<div><p>Before executing a MySQL/MariaDB/GreatSQL backup job, you need to enable permissions of the corresponding MySQL/MariaDB/GreatSQL version. Otherwise, registration, backup, or restoration will fail. The commands may vary depending on the version. You can contact O&amp;M personnel or database administrators to provide the corresponding commands.</p>
<div class="section"><h4 class="sectiontitle">Procedure</h4><p>The following uses the MySQL database as an example.</p>
<ol><li><span>Log in to the MySQL/MariaDB/GreatSQL host as user <strong>root</strong> and run the following command to log in to the MySQL/MariaDB/GreatSQL database:</span><p><pre class="screen">mysql -uroot -p<em>Password</em></pre>
<p>The command output is as follows.</p>
<p><span><img src="en-us_image_0000002164603462.png"></span></p>
</p></li><li id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_li1764574917387"><a name="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_li1764574917387"></a><a name="en-us_topic_0000001497361525_li1764574917387"></a><span>Record the value of <strong>Server version</strong>, which indicates the database version and will be used in subsequent operations.</span></li><li><span>Run the following commands to create a user:</span><p><pre class="screen" id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_screen1136353624011">CREATE USER '<em id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_i1854873016413">name</em>'@'127.0.0.1' IDENTIFIED BY '<em id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_i29651943164115">password</em>';</pre>
<p id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_p5990151215716">The command output is as follows.</p>
<p id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_p590814410810"><span><img id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_image1090844414814" src="en-us_image_0000001972715428.png"></span></p>
<div class="note" id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_note859311431182"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_p546984041616">If the resource fails to be connected, run the following command to change the identity authentication plug-in:</p>
<pre class="screen" id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_screen140134317224">alter user '<em id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_i9233118171918">name</em>'@'127.0.0.1' identified with mysql_native_password by '<em id="EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_i543201771916">password</em>';</pre>
</div></div>
</p></li><li><span>Run the following command to enable the permission of the corresponding database version for the user. You can obtain the database version from <a href="#EN-US_TOPIC_0000002164603378__en-us_topic_0000001497361525_li1764574917387">2</a>.</span><p><ul><li>MySQL 5.x:<pre class="screen">GRANT RELOAD, PROCESS, REPLICATION CLIENT, SUPER, LOCK TABLES  ON *.* TO '<em>name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li><li>MySQL 8.x/GreatSQL 8.x:<pre class="screen">GRANT BACKUP_ADMIN, SELECT, RELOAD, PROCESS, SUPER, LOCK TABLES  ON *.* TO '<em>name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li><li>MariaDB 10.5/10.6/10.7:<pre class="screen">GRANT RELOAD, PROCESS, BINLOG MONITOR, SUPER, LOCK TABLES ON *.* TO '<em>name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li><li>MariaDB 10.3/10.4:<pre class="screen">GRANT RELOAD, PROCESS, REPLICATION CLIENT, SUPER, LOCK TABLES ON *.* TO '<em>name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li><li>MariaDB 5.6/10.2:<pre class="screen">GRANT USAGE ON *.* TO '<em>name2</em>'@'127.0.0.1' IDENTIFIED BY '<em>password</em>';
GRANT RELOAD,PROCESS,SUPER,REPLICATION CLIENT,LOCK TABLES ON *.* TO '<em>name</em>'@'127.0.0.1';
FLUSH PRIVILEGES;</pre>
</li></ul>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0000002164603390.html">Backing Up the MySQL/MariaDB/GreatSQL Database</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">Copyright &copy; Huawei Technologies Co., Ltd.</div></body>
</html>